export function year(date,parttern){
	if(parttern==="%YY"){
		return date.getFullYear();
	}else if(parttern==="%yy"){
		return date.getFullYear().substr(-2);
	}else{
		return date.getFullYear();
	};
}
export function quarter(date,parttern){
	var EQ=["01","01","01","02","02","02","03","03","03","04","04","04"];
	var CQ=["一季度","一季度","一季度","二季度","二季度","二季度","三季度","三季度","三季度","四季度","四季度","四季度"];
	var qq=["1","1","1","2","2","2","3","3","3","4","4","4"];
	if(parttern==="%EQ"){
		return EQ[date.getMonth()];
	}else if(parttern==="%CQ"){
		return CQ[date.getMonth()];
	}else if(parttern==="%qq"){
		return qq[date.getMonth()];
	}else{
		return qq[date.getMonth()];
	};
}
export function month(date,parttern){
	var EM=["January","February","March","April","May","June","July","August","September",,"October","November","December"];
	var em=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Spt","Oct","Nov","Dec"];
	var CM=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"];
	var mm=["01","02","03","04","05","06","07","08","09","10","11","12"];
	if(parttern==="%EM"){
		return EM[date.getMonth()];
	}else if(parttern==="%CM"){
		return CM[date.getMonth()];
	}else if(parttern==="%em"){
		return em[date.getMonth()];
	}else if(parttern==="%mm"){
		return mm[date.getMonth()];
	}else{
		return date.getMonth();
	};
}
export function date(date,parttern){
	if(parttern==="%DD"){
		return ("0"+date.getDate()).substr(-2);
	}else if(parttern==="%dd"){
		return date.getDate();
	}else{
		return date.getDate();
	};
}
export function day(date,parttern){
	var EN=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];
	var en=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
	var CN=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
	if(parttern==="%EN"){
		return EN[date.getDay()];
	}else if(parttern==="%en"){
		return en[date.getDay()];
	}else if(parttern==="%CN"){
		return CN[date.getDay()];
	}else{
		return date.getDay();
	};
}
export function hour(date,parttern){
	if(parttern==="%HH"){
		return ("0"+date.getHours()).substr(-2);
	}else if(parttern==="%hh"){
		return date.getHours();
	}else{
		return date.getHours();
	};
}
export function minute(date,parttern){
	if(parttern==="%MM"){
		return ("0"+date.getMinutes()).substr(-2);
	}else if(parttern==="%mm"){
		return date.getMinutes();
	}else{
		return date.getMinutes();
	};
}

export default {year,quarter,month,date,day,hour,minute}